package com.quizzer.system.convert;

import com.quizzer.common.utils.bean.BeanUtils;
import com.quizzer.system.domain.Category;
import com.quizzer.system.dto.question.category.CategoryAddDto;
import com.quizzer.system.dto.question.category.CategoryOutputDto;
import com.quizzer.system.dto.question.category.CategoryQueryDto;
import com.quizzer.system.dto.question.category.CategoryUpdateDto;
import org.springframework.context.annotation.Bean;

/**
 * @author rong
 * @Description
 * @date 2025/10/7 20:48
 */
public class CategoryConverter {
    public static CategoryOutputDto toOutputDto(Category entity) {
        if(entity == null) {
            return null;
        }
        CategoryOutputDto dto = new CategoryOutputDto();
        BeanUtils.copyBeanProp(dto,entity);
        return dto;
    }
    public static Category toEntity(CategoryAddDto dto) {
        if(dto == null) {
            return null;
        }
        Category entity = new Category();
        BeanUtils.copyBeanProp(entity,dto);
        return entity;
    }
    public static Category toEntity(CategoryUpdateDto dto) {
        if(dto == null) {
            return null;
        }
        Category entity = new Category();
        BeanUtils.copyBeanProp(entity,dto);
        return entity;
    }
    public static Category toEntity(CategoryQueryDto dto) {
        if(dto == null) {
            return null;
        }
        Category entity = new Category();
        BeanUtils.copyBeanProp(entity,dto);
        return entity;
    }

}
